package com.example.login.repo

import com.example.common.entity.BaseResponse
import com.example.common.entity.UserEntity
import com.example.common.repo.BaseRepository
import com.example.http.OkHttpClientManager
import com.example.http.RetrofitManager
import com.example.login.api.AccountServerApi
import javax.inject.Inject

class AccountRepository : BaseRepository<AccountServerApi>(){
    override fun createApiServer(): AccountServerApi {
        return RetrofitManager.getRetrofit(OkHttpClientManager.createOkHttpClient()).create(AccountServerApi::class.java)
    }
    suspend fun loginToServer(userName: String, password: String): BaseResponse<UserEntity> {
        return apiServer.userLogin(userName, password)
    }

    suspend fun registerToServer(userName: String, password: String): BaseResponse<UserEntity>{
        return apiServer.userRegister(userName, password)
    }
}